{$keshow }
<load href="../Public/js/plugin/Uploadify/uploadify.css" />
<load href="../Public/js/plugin/Uploadify/swfobject.js" />
<load href="../Public/js/plugin/Uploadify/jquery.uploadify.v2.1.4.min.js" />

<!--<load href="../Public/js/module/Message/news_add.js" />-->
<script>
    $(function(){
        var newsAdd = new NewsAdd();
        newsAdd.init().init();
    });
    
    
    function NewsAdd(){
        this.init = function(){
            return NEWSADD;
        };
        var NEWSADD = {
            init : function(){
                NEWSADD.funs.initUpload();
                NEWSADD.listeners.bindEvents();
            },
            listeners : {
                bindFormSubmit : function(){
                    $("#btn_notice_add_submit").click(function(){
                        var $form = $("#news_app");
                    
                        var icon = $.trim($("#hid_news_icon").val());
                        if('' == icon){
                            alert('未上APP传缩略图');
                        
                            return;
                        }
                    
                        $form.validate();
                    
                        $form.submit();
                    });
                },
                bindEvents : function(){
                    $.util.foreachFunction(this, [ "bindEvents" ]);
                },
                bindUpload : function(){
                    $('#btn_app_icon_upload_enter').click(function(){
                        $('#btn_app_icon_upload').uploadifyUpload();
                    });
                }
            },
            funs  : {
                initUpload : function(){
                    $('#btn_app_icon_upload').uploadify({
                        'uploader'  : SYSTEM_DATA.public_path + '/js/plugin/Uploadify/uploadify.swf',
                        'script'    : SYSTEM_DATA.contextPath + '/File/upload',
                        'cancelImg' : SYSTEM_DATA.public_path + '/js/plugin/Uploadify/cancel.png',
                        'folder'    : '/uploads',
                        'removeCompleted' : true,
                        'auto'       : false,
                        'multi': false,
                        'fileExt' : '*.jpg;*.jpeg;*.png;*.gif',
                        'fileDesc' : '可上传的图片文件',
                        'sizeLimit' : 1024 * 1024 * 10,
                        //'buttonText' : '上传',
                        'onComplete'  : function(event, ID, fileObj, response, data) {
                            //console.debug(response);
                            //console.debug(data);
                            response = $.parseJSON(response);
                            //var lastId = response.data;
                            //                        console.debug(response);
                            //$fileId = $('#hid_file_id');
                            
        //alert(response.data.thumb_url);
                            $("#hid_news_icon").val(response.data.thumb_url);
                            //$fileId.val('' == $fileId.val() ? lastId : $fileId.val() + ',' + lastId);
                        },
                        'onError' : function(event,ID,fileObj,errorObj) {
                            //                        console.debug(errorObj);
                        }
                    });
                },
            
            
                //设置组件是否禁用
                setElementEnabled : function($element, enabled){
                    if(enabled){
                        $element.removeAttr('disabled');
                    }else{
                        $element.attr('disabled', 'disabled');
                    }
                },
            
                /*
                 *修改App信息时点类型弹出显示已选中的类型
                 **/
                initTypeId : function($dialog, typeId){
                    var $chk = $dialog.find(':checkbox');
                    $.each($chk, function(index, checkbox){
                        if(-1 != $.inArray($(checkbox).val(), typeId)){
                            //alert($(checkbox).val());
                            $(checkbox).attr('checked', 'checked');
                        }
                    });
                }
            }
        };
    }
</script>
<div class="sendTitleDiv marginleft10">
    添加新闻
</div>
<form id="news_app" action="__URL__/newsAdd" method="post">
    <input type="hidden" name="id" value="{$news.id }" />
    <input id="hid_news_icon" type="hidden" name="icon" value="{$news.icon }"/>
    <div class="width100Percent margintop20 "style="width:780px;padding-left:10px;">
        <table class="formTable ">
            <tr>
                <td>
                    <span>新闻标题</span>
                </td>
                <td colspan="3" class="textLength500">
                    <input type="text" name="name" class="{required:true,maxlength:128}"  value="{$news.name }" />
                    <span class="redSpan">*</span>
                </td>
            </tr>
            <tr>
                <td>
                    <span>截图上传</span>
                </td>
                <td style="width:300px;">
                    <div class="floatLeftDiv"><input type="button" id="btn_app_icon_upload"/></div>
                    <span class="redSpan" style="display:block;line-height:30px;float:left;">*</span>

                    <div class="marginleft10 floatLeftDiv"><input type="button" id="btn_app_icon_upload_enter" class="buttonStyle" value="上传缩略图icon"/></div>
                </td>
                <td>
                    <span>选择类型</span>
                </td>
                <td >
                    <select name="module">
                        <option value="苹果新闻" <if condition="$news.module eq 苹果新闻">selected="selected"</if> >苹果新闻</option>
                        <option value="苹果行情" <if condition="$news.module eq 苹果行情">selected="selected"</if> >苹果行情</option>
                        <option value="苹果评测" <if condition="$news.module eq 苹果评测">selected="selected"</if> >苹果评测</option>
                    </select>
                    <span class="redSpan">*</span>
                </td>
            </tr>
        </table>
        <div class="fromTableLineDiv">
            <div class="width20Percent" style="width:101px;float:left;">
                <span>详细内容</span>
            </div>
            <div class="width70Percent" style="width:528px;border-left:1px solid #957D47;float:left;">
                <div class="floatLeftDiv">
                    <textarea id="news_content" name="content_text" style="width: 519px; height: 400px; visibility: hidden;">
                {$news.content_text }
                    </textarea>
                </div>
                <div class="redSpan floatLeftDiv marginleft5">
                    *
                </div>
            </div>
        </div>
    </div>
    <div class="buttonRight margintop20">
        <input id="btn_notice_add_submit" type="button" class="buttonStyle" value="确定" />
        <input id="btn_notice_add_reset" type="reset" class="buttonStyle" value="重置" />
    </div>
</form>
<form id="frm_agents_manager_hidden" action="" method="post"></form>

<div id="div_app_type_dialog"></div>

